home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AGA Toolkit '97
/
The AGA Toolkit '97.iso
/
c
/
play16.doc
< prev
next >
Wrap
Text File
|
1996-09-07
|
12KB
|
292 lines
-- Play16 version 1.2 - a versatile soundplayer for the Amiga --
Features in brief
-----------------
- autodetects and plays several soundfiles, up to 16 bit / 56 kHz / stereo
- always correct playback speed, even for sounds >28 kHz
- plays mono sounds on *both* channels, not only on the left one
- plays files that are larger than memory
- preloading for exactly timed start of playback
- fast uLaw decompression
- system friendly audio channel allocation
- supported Filetypes are:
* Microsoft RIFF-WAVE (.WAV) mono / stereo, 8 / 16 bit, linear / uLaw
* Sun/NeXT Audio (.AU) mono / stereo, 8 / 16 bit, linear / uLaw
* MacroSystem MAUD (.MAUD) mono / stereo, 8 / 16 bit, linear
* Apple/SGI/Amiga AIFF (.AIFF) mono / stereo, 8 / 16 bit, linear
* Amiga IFF-8SVX (.IFF) mono / stereo, 8 bit, linear
* Any raw sound data as long as it matches one of the following:
- 8 bit signed
- 8 bit unsigned
- 16 bit signed, Intel format (LSB first)
- 16 bit signed, Motorola format (MSB first)
What do I need to use Play16?
-----------------------------
Any Amiga running Kickstart/Workbench 2.04 or greater.
What does it do?
----------------
Basically, Play16 is capable of playing uncompressed and _some_ compressed
soundfiles through Amiga's standard audio device. If the actual resolution
or playback rate exceeds that of the Amiga hardware, realtime conversion
is done so that the sound is being played back correctly.
You can even play 16 bit / 44.1 kHz sounds, providing all parts of
your system can keep up with the high data transfer rate and lots
of calculations needed for this task. (In this case an accelerated
Amiga is recommended :-)
I don't want Play16 to be a program that plays each and every exotic format
that exists somewhere. However, I intend to support as many popular file
types as possible
How do I use it?
----------------
Simply type "Play16 <filename>" and that's it!
All possible options will be explained later. If you set none of them, the
defaults will be used.
Why Play16?
-----------
16 bit soundcards are becoming more and more popular, especially on the
PC. The common file format over there is Microsoft's (yuck! :)) RIFF-
WAVE format.
I didn't find any CLI based program to play back 16 bit recordings, on a
standard Amiga, so I decided to write one myself.
Why CLI based and no GUI?
-------------------------
There are so many GUI based directory utilities, simply use Play16 as an
external player. Consult the manual of your software package on how to
do it. Application example: Assign "Play16 <filename> PRELOAD" to a button
called "Jingle". Select the desired soundfile and press the Jingle-button.
Wait for the appropriate moment and hit the return key - here comes the
sound! Nice when audio dubbing your home videos or even on parties :-)
How does it work? (technical info)
----------------------------------
The standard Amiga audio device is limited to 8 bit / 28 kHz playbck
when using DMA. With the introduction of ECS the 28 kHz DMA barrier
was broken - but only if the current displaymode was one with double
scan rate like productivity. If you don't have ECS or if you simply
don't want to switch to Productivity just to listen to your desired
sound, Play16 can can halve the sample rate during playback. In the
current version of Play16 only 8 bit output is supported so 16 bit
sounds are converted accordingly.
To play back even long sounds, the popular method of double buffering
is used. Alternatively, all data can be loaded into memory before
playback. This is useful when playing short sounds or when loading
the sound from disk.
What options are provided?
--------------------------
If you are not familiar with the AmigaOS 2.x commandline template, see
the examples below and consult the AmigaOS manual for furhter information.
FAST/S Do not automatically switch to halve sample rate if the
soundfile's rate exceeds 28 kHz. Use this option when
running your Amiga in Productivity or similar display
modes.
SINGLE/S Use only one buffer rather then two and load all data into
memory befor playback.
BUFFER/N Buffersize in samples. May vary from 32768 to 131072. The
amount of allocated memory also depends on whether the sound
is mono or stereo, 8 bit or 16 bit.
Default is 65536 samples, values are rounded to multiples of
32768.
Note that it is useless to modify this value when in single
buffer mode :)
VERBOSITY/N Sets the level of verbosity.
0: Just display the banner and error messages
1: Print additional information about the sound file,
allocated memory, etc.
2: Progress information
3: Debugging information (may look a bit weird :)
Default is level 0.
LOOPS/N Determines the number of loops to be played.
Default is 1 loop. (Play the sound once.)
This option is not yet supported in SINGLE mode.
PRELOAD/S Load enough data into memory for immediate start of playback
a a keypress
RAW/S Disable autodetect and tell Play16 what the actual format of
the sound data is.
The following options are only valid when in RAW mode:
FREQ/N Sampling frequency in Hz
TRACKS/N Number of tracks, 1 for mono, 2 for stereo
BITS/N Resolution in bits, may be 8 or 16
HEADER/N Length of header: This is the number of bytes to be skipped
at the beginning of the file.
UNSIGNED/S Data is unsigned, not signed (only valid for 8 bit sounds)
INTEL/S Data is in Intel format (only valid for 16 bit sounds)
ULAW/S Data is compressed using the uLaw compression scheme
The default settings are: 22050 Hz, mono, 8 bits, no header.
Examples:
a) Play16 music.wav
Simply play the file called music.wav once and directly from harddisk.
b) Play16 music.wav SINGLE
Same as above but load all data into memory before playback. Use this
when loading soundfiles from floppy disk.
c) Play16 music.wav SINGLE VERBOSITY=1
Same as b, but with additional information being printed out.
d) Play16 rhythm.wav LOOPS=10
Play the rhythm as a continuous loop, i.e. over and over again (10 times)
e) Play16 explosion.wav SINGLE PRELOAD
Load the complete explosion sound into memory, then wait for you to hit
<return> before playback.
How do I use this RAW mode?
---------------------------
Umm, err, difficult to explain, even harder to understand...
Well, if you know the data format of the soundfile, simply set RAW, FREQ,
TRACKS, BITS, UNSIGNED and INTEL accordingly. If you don't, the only
way to find it out is by trial and error :) Here are some tips to make
it a bit easier:
Don't set HEADER to an odd number. (Leave it at 0, first.)
If you set BITS to 16 and hear nothing but noise, try to set INTEL.
If you set BITS to 8 and the sound is distorted, try to set UNSIGNED.
If the above does not help, try different combinations of BITS, INTEL
and UNSIGNED.
If you manage to get a recognisable sound output which is either too
fast or too slow, start experimenting on TRACKS and FREQ.
Legal stuff
-----------
Play16 is copyrighted freeware. It may be distributed freely as long as
no modifications are made to the executable and this document. A nominal
fee may be asked to cover distribution costs.
Play16 may not be used for any commercial purposes or included with any
commercial product without the written permission of the author.
No responsibilities are taken for damaged speakers, amplifiers, Amigas
or any other components or data involved while using Play16.
Although I've done some beta testing I can't guarantee that Play16 will
not crash! If you find any bugs, let me know.
Miscellaneous
-------------
I don't claim Play16 to be fast. I've done some optimizing - but because
the loader/converter module is a universial one, more data is actually
being moved around different memory blocks than needed for playback.
This method will however provide the basis for future enhancements in the
playback routine like cascading two channels to archieve 14 bit output.
I may also support some soundcards as well.
* Please note that English is not my native language :)
I can be reached at...
Internet: wenzel@unixserv.rz.fh-hannover.de
Thomas_Wenzel@aventure.fido.de
Fido: 2:243/6050.28 or 2:241/1035.6
Mail routing _is_sometimes_ unreliable in FidoNet :-(
Snail: Thomas Wenzel
Dresdener Str. 20
31789 Hameln
Germany
If you use this program, please send me a mail. I'd like to know how many
people are interested in it at all.
History
-------
V0.5ß - Initial beta test release
V0.6ß - Optimized the code a bit.
V0.7ß - Fixed some severe bugs that caused Play16 to crash when trying
to load corrupted files.
V0.8ß - Play16 can now be stopped by pressing ctrl-c during playback. The
buffer that is currently being played will be finished first.
- Automatic filter control depending on sample rate.
V0.9ß - Added 'loop'-option. Sample can be played several times.
- All time consuming routines now in hand optimized assembler code.
V1.0ß - Play16 now uses standard OS2.x commandline template.
Thanks to Kai for persuading me to do this :)
V1.0 - Done some minor bugfixes.
V1.1 - Oops! Play16 caused some Enforcer hits. Fixed that.
Thanks to Rod Schnell for reporting it.
- Added 'single'-option. Sound can be loaded completely into memory
before playing. No looping possible in this case yet!
- Playback time in minutes:seconds displayed if verbose >= 1
- uLaw decompression for WAVE-Files, using a decoding table
for maximum speed (didn't do much testing on it, hope it works!)
- MAUD filetype support (why do there have to be so many formats?)
- AIFF filetype support
Note that the AIFF sounds saved with MacroSystem's MPro software
contain a corrupt ANNO chunk :-/
Play16 will detect this and play the file anyway.
- ctrl-c now stops playback immediately.
Thanks to Marc for some programming tips about that.
V1.2 - IFF-8SVX filetype support (only uncompressed files!)
- RAW data support: _Any_ data can be played
- Preload feature added
- Fixed a bug that caused illegal memory access (hopefully)
Thanks to Ignatios Souvatzis for reporting it.
- Improved chunk handling
Future plans
------------
- other uLaw-formats and maybe Creative-VOC support
- ADPCM decompression (still having difficulties coding the algorhytm)
(Could anyone please send me the 16bit VOC specs, including ADPCM?)
- some of the file types saved by Macintosh software (e.g. Sound-Designer)
- 14 bit output (this &%$!# routine still won't work :-((( )
- Soundcard support
- More information about Sound (AUTHOR or ANNO-Chunk)
(coming very soon, made possible by the new chunk handling routines)
Credits
-------
Thanks go to the following persons:
Kai Stuke for many vital hints on C programming and the Amiga
audio device.
for beta testing this program.
Marc Führer for doing some beta testing as well.
for some hints on optimizing the code.
Clete Baker for supplying the AIFF- and SDII specs.